package test08;

import java.io.*;

/**
 * 4. 利用字节流将E盘下的a.png图片复制到D盘下(文件名保存一致)
 */
public class TestDemo04 {
    public static void main(String[] args) throws IOException {
        /*FileInputStream fis = new FileInputStream("E:\\a.png");
        FileOutputStream fos = new FileOutputStream("D:\\a.png");*/

        BufferedInputStream bis = new BufferedInputStream(new FileInputStream("E:\\a.png"));
        BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream("D:\\a.png"));

        int len ;
        byte[] bytes = new byte[1024];

        while ((len = bis.read(bytes))!=-1){
            bos.write(bytes,0,len);
        }

        bis.close();
        bos.close();
    }
}
